/*
* =====================================================================================
*
*       Filename:  gdbus_server.h
*
*    Description:
*
*        Version:  1.0
*        Created:  10/31/2017 10:11:19 AM
*       Revision:  none
*       Compiler:  gcc
*
*         Author:  qiaotsh (), qiaotsh@neusoft.com
*   Organization:  www.neusoft.com
*
* =====================================================================================
*/
#ifndef __OFPRINT_SERVER_H_
#define __OFPRINT_SERVER_H_

#define DRIVER_VERSION_MAJOR 	1
#define DRIVER_VERSION_MINOR 	0
#define DRIVER_VERSION_FUNCTION 18



#define OMS_GDBUS_OFP_BUS_TYPE	G_BUS_TYPE_SYSTEM //SESSION
#define OMS_GDBUS_OFP_BUS_NAME	"ofilm.oms.Ofprint"
#define OMS_GDBUS_OFP_OBJECT_PATH	"/ofilm/oms/Ofprint"

#define OFPRINT_DEVICE_NAME			"ofp2388"
#define OFPRINT_DEVICE_FULL_NAME	"OMS OFP2388"

//#define OFP_VERIFY_TIMES_MAX	5//最大验证次数

#define OFP_DEBUG_MODE_FLAG	1234
#define OFP_USER_MODE_FLAG	1

#define OFP_SET_REBOOT_FLAG	2345



typedef void (*OFP_ENROLL_STATUS_CALLBACK)(char *id, int code, char *msg);
typedef void (*OFP_VERIFY_STATUS_CALLBACK)(char *id, int code, char *msg);
typedef void (*OFP_TOUCH_CALLBACK)(char *id, gboolean pressed);
typedef void (*OFP_IDENTIFY_WITH_MULTIPLE_USER_STATUS_CALLBACK)(char *uuid);



#define GDBUS_API  __attribute__((visibility("hidden")))

//指纹设备状态
typedef enum _OFP_DEV_STATE_ENUM_
{
	DeviceStateNormal = 1 << 0, // 设备正常可用
	DeviceStateClaimed = 1 << 1, // 设备被独占
}OFP_DEV_STATE_ENUM;

//指纹设备类型
typedef enum _OFP_DEV_TYPE_ENUM_
{
	DeviceTypeUnknown = 0, // 未知类型
	DeviceTypeScanning, // 扫描式指纹设备
	DeviceTypeTouch, // 触摸式指纹设备
}OFP_DEV_TYPE_ENUM;

//指纹设备特性
typedef enum _OFP_DEV_CAPABILITY_ENUM_
{
	DeviceCapAutologin = 1, // 支持指纹一键自动登录
}OFP_DEV_CAPABILITY_ENUM;




//指纹录入状态
typedef enum _OFP_ENROLL_STATUS_ENUM_
{
	OFP_ENROLL_STATUS_SUCCESS =0,
	OFP_ENROLL_STATUS_FAILED = 1,
	OFP_ENROLL_STAGE_PASSED = 2,
	OFP_ENROLL_STAGE_RETRY =3,	//重新录入
	OFP_ENROLL_STAGE_DISCONNECTED = 4,	//设备失联
}OFP_ENROLL_STATUS_ENUM;

//指纹验证重试子状态
typedef enum _OFP_ENROLL_RETRY_SUBCODE_ENUM_
{
	OFP_ENROLL_TOUCH_TOO_SHORT = 1,//接触时间过短
	OFP_ENROLL_IMG_CANT_USE = 2,	//图形不可用
	OFP_ENROLL_POSITION_REPEATED = 3,	//两次触摸的指纹信息重复率过高
	OFP_ENROLL_FPRINT_ALREADY_EXIST = 4,//当前指纹已经存在，请换其他的手指
	OFP_ENROLL_SWIPE_TOO_SHORT = 5,//滑动太短
	OFP_ENROLL_FINGER_NOT_CENTERED = 6,	//手指不在中间
	OFP_ENROLL_REMOVE_AND_RETRY = 7,	//拿开手指再重新扫描
}OFP_ENROLL_RETRY_SUBCODE_ENUM;


//指纹验证状态
typedef enum _OFP_VERIFY_STATUS_ENUM_
{
	OFP_VERIFY_STATUS_MATCH =0,
	OFP_VERIFY_STATUS_NOMATCH = 1,
	OFP_VERIFY_STAGE_ERROR = 2,
	OFP_VERIFY_STAGE_RETRY =3,	//重新验证
	OFP_VERIFY_STAGE_DISCONNECTED = 4,	//设备失联
}OFP_VERIFY_STATUS_ENUM;

//指纹验证重试子状态
typedef enum _OFP_VERIFY_RETRY_SUBCODE_ENUM_
{
	OFP_VERIFY_SWIPE_TOO_SHORT =1,//滑动太短
	OFP_VERIFY_FINGER_NOT_CENTERED = 2,//手指不在中间
	OFP_VERIFY_REMOVE_AND_RETRY = 3,//	拿开手指重新扫描
	OFP_VERIFY_TOUCH_TOO_SHORT = 4,	//手指按压时间过短
	OFP_VERIFY_QUALITY_BAD = 5,	//图像质量太差
}OFP_VERIFY_RETRY_SUBCODE_ENUM;




GDBUS_API void GBusAcquired_Callback (GDBusConnection *connection,
	const gchar *name,
	gpointer user_data);

GDBUS_API void GBusNameAcquired_Callback (GDBusConnection *connection,
	const gchar *name,
	gpointer user_data);

GDBUS_API void GBusNameLost_Callback (GDBusConnection *connection,
	const gchar *name,
	gpointer user_data);

extern int ofp_set_dev_state(uint8 state);

extern int enable_printf_log(int flag);



#endif

